package com.xq.xq.kotlinlearnsingletom.kotlin

/**
 * @author aidenquan
 *         Created by junlintianxia on 2021/07/04.
 */
class SingletonCKt private constructor() {

    override fun toString(): String {
        return "SingletonCKt"
    }

    companion object {
        var ins: SingletonCKt? = null
            get() {
                if (field == null) {
                    field = SingletonCKt()
                }
                return field
            }
            private set

        @Synchronized
        fun getInstance(): SingletonCKt {
            return ins!!
        }
    }
}